package com.okami.json;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author: TanJingyu
 * @create: 2021-01-13 16:20
 **/
class JacksonTest {
    public static void main(String[] args) throws JsonProcessingException {
        Student student = new Student("王吉", 23);
//        ObjectMapper json = new ObjectMapper();
//        System.out.println(json.writeValueAsString(student));
//        System.out.println(json.readValue(json.writeValueAsString(student), Student.class));


        System.out.println(JsonUtils.toString(student));

        System.out.println(JsonUtils.toObject(JsonUtils.toString(student), Student.class));

    }
}
